﻿using System;
using System.Collections.Generic;
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace SecondaryTiles
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void BtnIconic_Click(object sender, RoutedEventArgs e)
        {
            //ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
            var iconicTile = new IconicTileData();

            iconicTile.Title = "Test Iconic Tile using C#";
            iconicTile.Count = 7;
            //iconicTile.BackgroundColor = Colors.Transparent;
            iconicTile.IconImage = new Uri("Assets/Tiles/Football2small.png", UriKind.Relative);
            iconicTile.SmallIconImage = new Uri("Assets/Tiles/Football2medium.png", UriKind.Relative);
            iconicTile.WideContent1 = "Iconic Tile";
            iconicTile.WideContent2 = "made by";
            iconicTile.WideContent3 = "C# code";
            
            ShellTile.Create(new Uri("/MainPage.xaml?id=iconic", UriKind.Relative), iconicTile, true);
        }

        private void BtnCycle_Click(object sender, RoutedEventArgs e)
        {
            var cycleTile = new CycleTileData();
            cycleTile.Title = "Test Cycle Tile using C#";
            cycleTile.Count = 17;
            cycleTile.SmallBackgroundImage = new Uri("Assets/Tiles/logo.png", UriKind.Relative);

            var images = new List<Uri>();
            images.Add(new Uri("Assets/Images/MaximusVictoria.png", UriKind.Relative));
            images.Add(new Uri("Assets/Images/Meirik71.jpg", UriKind.Relative));
            images.Add(new Uri("Assets/Images/naturgress.jpg", UriKind.Relative));
            images.Add(new Uri("Assets/Images/RBK1917.jpg", UriKind.Relative));
            images.Add(new Uri("Assets/Images/RBKlogo.png", UriKind.Relative));
            images.Add(new Uri("Assets/Images/RBKlogo_Lerkendal.jpg", UriKind.Relative));
            images.Add(new Uri("Assets/Images/RBKlogo_b.jpg", UriKind.Relative));
            images.Add(new Uri("Assets/Images/strand.jpg", UriKind.Relative));

            cycleTile.CycleImages = images;
            ShellTile.Create(new Uri("/MainPage.xaml?id=cycle", UriKind.Relative), cycleTile, true);
        }

        private void BtnFlip_Click(object sender, RoutedEventArgs e)
        {
            //ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();

            var flipTile = new FlipTileData();
            flipTile.Title = "Test Flip Tile using C#";
            flipTile.Count = 22;
            flipTile.BackTitle = "Medium sized text";
            flipTile.WideBackContent = "Wide and long text";
            flipTile.SmallBackgroundImage = new Uri("Assets/Tiles/trolleysmall.png", UriKind.Relative);
            flipTile.BackgroundImage = new Uri("Assets/Tiles/trolleymedium.png", UriKind.Relative);
            flipTile.BackBackgroundImage = new Uri("Assets/Images/logo.png", UriKind.Relative);
            flipTile.WideBackBackgroundImage = new Uri("Assets/Images/strand.jpg", UriKind.Relative);
            
            ShellTile.Create(new Uri("/MainPage.xaml?id=flip", UriKind.Relative), flipTile, true);
        }

    }
}